<template>
  <div>
    <div>
      <ul>
        <li>宝贝数量：</li>
        <li><button v-on:click="subtract()">-</button></li>
        <!-- <input type="button" value="事件绑定" v-on:click="方法名"> -->
        <li><input type="text" value="0" size="1" v-model="count" /></li>
        <li><button v-on:click="add()">+</button></li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: 0,
    };
  },

  mounted() {},

  methods: {
    add() {
      this.count++;
    },
    subtract() {
      if (this.count <= 0) {
        console.log("哥哥，没法在减了哦");
      } else {
        this.count--;
      }
    },
  },
};
</script>